package com.usian.job;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component  //该类作为一个普通类要注入到spring IOC 容器中
public class Schedule {


    @Scheduled(cron = "0/2 * * * * ?")
    public void demo(){
        System.out.println("定时器被触发："+new Date());
    }
}
